<template>
  <header class="header">
    <div class="container">
      <div class="nav-container">
        <div class="logo">城乡一体化示范区双创门户</div>
        <ul class="nav-menu">
          <li class="nav-item" :class="path === '' ? 'active' : '' ">
            <router-link to="/">首页</router-link>
          </li>
          <li class="nav-item" :class="path === 'sc_intellComput'? 'active' : '' ">
            <router-link to="/sc_intellComput">政策法规</router-link>
          </li>
          <li class="nav-item" :class="path === 'sc_emplat'? 'active' : '' ">
            <router-link to="/sc_emplat">双创支撑</router-link>
          </li>
          <li class="nav-item" :class="path === 'sc_knowhub'? 'active' : '' ">
            <router-link to="/sc_knowhub">动态咨询</router-link>
          </li>
          <li class="nav-item" :class="path === 'sc_modelhub'? 'active' : '' ">
            <router-link to="/sc_modelhub">企业云图</router-link>
          </li>
          <li class="nav-item" :class="path === 'sc_applicationscen'? 'active' : '' ">
            <router-link to="/sc_applicationscen">联系我们</router-link>
          </li>
        </ul>
      </div>
    </div>
  </header>
</template>
<script setup>
import {ref} from 'vue'
import {Calendar, Search} from '@element-plus/icons-vue'
import {useRouter, useRoute} from 'vue-router'  // 引入路由钩子
// 初始化路由实例
const router = useRouter()
const route = useRoute()
const path = route.path?.slice(1)
const active = ref('/')
console.log(22,path)
active.value = path
const activeIndex = ref(path || '/')

</script>
<style scoped>
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* 顶部导航栏 */
.header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
}

.logo::before {
  content: "🏢";
  margin-right: 10px;
}

.nav-menu {
  display: flex;
  list-style: none;
}

.nav-item {
  margin-left: 30px;
  position: relative;
}

.nav-item a {
  color: white;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 5px 0;
  transition: all 0.3s ease;
}

.nav-item a:hover {
  color: #4facfe;
}

.nav-item.active a {
  color: #4facfe;
  border-bottom: 2px solid #4facfe;
}
</style>